<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div>
            <p></p>
        </div>
    </div>
</body>

<script>
    // 为指定的 div 的子元素 div 的子元素p标签，展示变量 msg
    const divEle = document.querySelector('#app');
    const subDivEle = divEle.querySelector('div');
    const pEle = subDivEle.querySelector('p');
    const msg = 'hello world';
    pEle.innerHTML = msg;
</script>
</html>